#define  _CRT_SECURE_NO_WARNINGS
#include <vector>
using namespace std;
#include <iostream>
class Solution {
public:
    double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
        int n1 = nums1.size(), n2 = nums2.size();
        vector<int> nums(n1 + n2);
        for (int i = 0, j = 0, k = 0; i < n1 + n2; i++)
        {
            if (j < n1 && k < n2 && nums1[j] < nums2[k] || k == n2 )
                nums[i] = nums1[j++];
            else if (j < n1 && k < n2 && nums1[j] >= nums2[k] || j == n1)
                nums[i] = nums2[k++];
        }
        if ((n1 + n2) / 2 == 1)
            return nums[(n1 + n2) / 2];
        else return (nums[(n1 + n2) / 2] + nums[(n1 + n2) / 2 - 1]) / 2.0;
    }
};

int main()
{
    vector<int> v1{ };
    vector<int> v2{ 1 };
    Solution().findMedianSortedArrays(v1, v2);
}